<!-- Radio -->
<template>
  <el-radio-group v-model="radioValue" :size="size" :border="border" :disabled="disabled" @change="handleChange">
    <el-radio v-for="v in options" :label="v.value" :key="v.value">{{v.label}}</el-radio>
  </el-radio-group>
</template>

<script>
export default {
  name: 'Radio',
  data () {
    return {
      radioValue: '',
      loading: false
    }
  },
  props: {
    value: {
      type: String,
      default: ''
    },
    options: {
      type: Array,
      default: () => []
    },
    disabled: {
      type: Boolean,
      default: false
    },
    border: {
      type: Boolean,
      default: false
    },
    size: {
      // medium/small/mini 仅在 border 为真时有效
      type: String,
      default: 'medium'
    }
  },
  mounted () {
    this.radioValue = this.value
  },
  methods: {
    handleChange (value) {
      this.$emit('input', value)
      this.$emit('change', value)
    }
  }
}

</script>
